/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package co.com.entidad;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author 841756
 */
@Entity
@Table(name = "tbltercero")
@NamedQueries({
    @NamedQuery(name = "Tbltercero.findAll", query = "SELECT t FROM Tbltercero t"),
    @NamedQuery(name = "Tbltercero.findByCodTercero", query = "SELECT t FROM Tbltercero t WHERE t.codTercero = :codTercero"),
    @NamedQuery(name = "Tbltercero.findByNomTercero", query = "SELECT t FROM Tbltercero t WHERE t.nomTercero = :nomTercero"),
    @NamedQuery(name = "Tbltercero.findByNitTercero", query = "SELECT t FROM Tbltercero t WHERE t.nitTercero = :nitTercero")})
public class Tbltercero implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 5)
    @Column(name = "cod_tercero")
    private String codTercero;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "nom_tercero")
    private String nomTercero;
    @Column(name = "nit_tercero")
    private Long nitTercero;
    @JoinColumn(name = "cod_compania", referencedColumnName = "cod_compania")
    @ManyToOne(optional = false)
    private Tblcompania codCompania;
    @JoinColumn(name = "id_estado", referencedColumnName = "id_estado")
    @ManyToOne(optional = false)
    private TblEstado idEstado;

    public Tbltercero() {
    }

    public Tbltercero(String codTercero) {
        this.codTercero = codTercero;
    }

    public Tbltercero(String codTercero, String nomTercero) {
        this.codTercero = codTercero;
        this.nomTercero = nomTercero;
    }

    public String getCodTercero() {
        return codTercero;
    }

    public void setCodTercero(String codTercero) {
        this.codTercero = codTercero;
    }

    public String getNomTercero() {
        return nomTercero;
    }

    public void setNomTercero(String nomTercero) {
        this.nomTercero = nomTercero;
    }

    public Long getNitTercero() {
        return nitTercero;
    }

    public void setNitTercero(Long nitTercero) {
        this.nitTercero = nitTercero;
    }

    public Tblcompania getCodCompania() {
        return codCompania;
    }

    public void setCodCompania(Tblcompania codCompania) {
        this.codCompania = codCompania;
    }

    public TblEstado getIdEstado() {
        return idEstado;
    }

    public void setIdEstado(TblEstado idEstado) {
        this.idEstado = idEstado;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codTercero != null ? codTercero.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tbltercero)) {
            return false;
        }
        Tbltercero other = (Tbltercero) object;
        if ((this.codTercero == null && other.codTercero != null) || (this.codTercero != null && !this.codTercero.equals(other.codTercero))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "" + nomTercero + "";
    }
    
}
